#include <string.h>
#include <unistd.h>
#include <stdio.h>
#include <netdb.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <iostream>
#include <fstream>
#include <strings.h>
#include <stdlib.h>
#include <string>
#include <pthread.h>
#include "server.h"
//#include <signal.h>

class TestServer : public serverTCP
{
public:
	TestServer(int port) : serverTCP(port)
	{

	}
	void dataReceive(com::Block const& block, socketTCP* socket)
	{
		com::Block sendblock;
		socket->sendString(sendblock);
	}

};


int main(int argc, char* argv[])
{

	if (argc < 2)
	{
		cerr << "Syntam : ./server <port>" << endl;
		return 0;
	}

	int portNo = atoi(argv[1]);

	if((portNo > 65535) || (portNo < 2000))
	{
		cerr << "Please enter a port number between 2000 - 65535" << endl;
		return 0;
	}

	TestServer server(portNo);
	server.join();
	return 0;
}
